/**
 * @Author:Geln Yang
 * @Created:2008-8-3
 * $ Revision: 1.0 $
 * $ Author: Geln Yang $
 * $ Date: 2008-8-3 $
 */
package org.geln.web.page;

/**
 * @Author:Geln Yang
 * @Created:2008-8-3
 */
public class Page {
	private int pageSize;
	
	private int currentPage;
	
	private int totalPage;
	
	private int recordCount;

	public int getCurrentPage() {
		return currentPage < 1 ? 1 : currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public int getRecordCount() {
		return recordCount;
	}

	public void setRecordCount(int recordCount) {
		this.recordCount = recordCount;
        this.totalPage = (recordCount % this.getPageSize())>0 
        	? recordCount / this.getPageSize() +1 : recordCount / this.getPageSize();
        this.currentPage = (this.totalPage> this.currentPage || this.totalPage ==0) ? this.currentPage : this.totalPage;
	}	
	
	
}
